package cz.cuni.mff.ufal.httpserver.protocol;

/**
 * The enum which represents supported HTTP protocol versions.
 * 
 * @author Bartłomiej Etenkowski
 */
public enum HttpProtocol {
  HTTP_09("HTTP/0.9"),
  HTTP_10("HTTP/1.0"),
  HTTP_11("HTTP/1.1");
  
  private String str;
  
  private HttpProtocol(String str) {
    this.str = str;
  }
  
  @Override
  public String toString() {
    return str;
  }
  
  public static HttpProtocol parse(String str) {
    for (HttpProtocol p : HttpProtocol.values()) {
      if (p.str.equals(str)) {
        return p;
      }
    }
    return null;
  }
}
